package com.xy.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.tencentcloudapi.faceid.v20180301.models.ImageRecognitionResponse;
import com.tencentcloudapi.iai.v20200303.models.DetectFaceResponse;
import com.xy.dto.RealNameDTO;
import com.xy.service.RealAuthService;
import com.xy.vo.RealNameVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@RestController
@AllArgsConstructor
@RequestMapping("real-name")
@Slf4j
@Api(value = "实名认证公用接口管理", tags = "实名认证公用接口管理")
public class RealNameController {
	private final RealAuthService realAuthService;
	/**
	 * 查询用户
	 * @param realNameDTO
	 * @return
	 */
	@PostMapping("/get-rlea-name")
	@ApiOperationSupport(order = 4)
	@ApiOperation(value = "票证查询通过身份证号或护照号查询", notes = "传入idNumber、身份证号或护照号")
	public R<RealNameVO> getRleaName(@RequestBody RealNameDTO realNameDTO) {
		return R.data(realAuthService.getRleaName(realNameDTO));
	}
	/**
	 * 人脸检测
	 * @param headUrl
	 * @return
	 */
	@GetMapping("/check-face")
	@ApiOperationSupport(order = 4)
	@ApiOperation(value = "人脸检测", notes = "传入头像地址")
	public R checkFace(String headUrl) {
		return R.status(realAuthService.chekFace(headUrl));
	}
	/**
	 * 三要素实名认证
	 * @param
	 * @return
	 */
	@PostMapping("/domestic-ticket")
	@ApiOperationSupport(order = 4)
	@ApiOperation(value = "三要素实名认证", notes = "三要素实名认证")
	public R domestic(@RequestBody RealNameDTO realNameDTO) {
			return R.status(realAuthService.rleaNameAuth(realNameDTO));
	}
}
